package com.shinektv.utils;

import android.os.SystemClock;

/**
 * @author wk
 * @date 2024/12/5 10:23
 * @describe
 */
public class TimeCounter {
    public TimeCounter() {

    }

    public void start() {
        mStartClock = SystemClock.elapsedRealtime();
    }

    public void reset() {
        mStartClock = SystemClock.elapsedRealtime();
    }

    /**
     * 持续时间毫秒
     * @return
     */
    public long duration_mills() {
        return SystemClock.elapsedRealtime() - mStartClock;
    }

    /**
     * 持续时间秒
     * @return
     */
    public long duration_seconds() {
        return (SystemClock.elapsedRealtime() - mStartClock) / 1000;
    }

    private long mStartClock = 0;
}
